@@ -3,10 +3,12 @@ package ai.pai.lensman.briefs; |
||
3 | 3 |
import android.content.Intent; |
4 | 4 |
import android.graphics.Color; |
5 | 5 |
import android.os.Bundle; |
6 |
+import android.support.annotation.IdRes; |
|
6 | 7 |
import android.support.annotation.Nullable; |
7 | 8 |
import android.text.TextUtils; |
8 | 9 |
import android.view.Gravity; |
9 | 10 |
import android.view.View; |
11 |
+import android.widget.RadioGroup; |
|
10 | 12 |
import android.widget.TextSwitcher; |
11 | 13 |
import android.widget.TextView; |
12 | 14 |
import android.widget.ViewSwitcher; |
@@ -17,11 +19,13 @@ import ai.pai.lensman.R; |
||
17 | 19 |
import ai.pai.lensman.activities.WebViewActivity; |
18 | 20 |
import ai.pai.lensman.base.BaseActivity; |
19 | 21 |
import ai.pai.lensman.bean.BriefsBean; |
22 |
+import ai.pai.lensman.db.Preferences; |
|
20 | 23 |
import ai.pai.lensman.settings.SettingsActivity; |
21 | 24 |
import ai.pai.lensman.utils.UmengEvent; |
22 | 25 |
import ai.pai.lensman.utils.UrlContainer; |
23 | 26 |
import butterknife.BindView; |
24 | 27 |
import butterknife.ButterKnife; |
28 |
+import butterknife.OnCheckedChanged; |
|
25 | 29 |
import butterknife.OnClick; |
26 | 30 |
|
27 | 31 |
public class BriefsActivity extends BaseActivity implements BriefsContract.View{ |
@@ -35,7 +39,7 @@ public class BriefsActivity extends BaseActivity implements BriefsContract.View{ |
||
35 | 39 |
@BindView(R.id.tv_box_num) TextView boxNumText; |
36 | 40 |
@BindView(R.id.tv_box_status) TextView boxStatusText; |
37 | 41 |
@BindView(R.id.tv_current_price) TextView currentPriceText; |
38 |
- |
|
42 |
+ @BindView(R.id.rg_upload_settings) RadioGroup uploadDelayRadioGroup; |
|
39 | 43 |
private BriefsPresenter presenter; |
40 | 44 |
|
41 | 45 |
@Override |
@@ -43,7 +47,26 @@ public class BriefsActivity extends BaseActivity implements BriefsContract.View{ |
||
43 | 47 |
super.onCreate(savedInstanceState); |
44 | 48 |
setContentView(R.layout.activity_briefs); |
45 | 49 |
unbinder = ButterKnife.bind(this); |
46 |
- |
|
50 |
+ int delay = Preferences.getInstance().getUploadDelay(); |
|
51 |
+ if(delay==5){ |
|
52 |
+ uploadDelayRadioGroup.check(R.id.rb_upload_fast); |
|
53 |
+ }else if(delay==10){ |
|
54 |
+ uploadDelayRadioGroup.check(R.id.rb_upload_normal); |
|
55 |
+ }else { |
|
56 |
+ uploadDelayRadioGroup.check(R.id.rb_upload_slow); |
|
57 |
+ } |
|
58 |
+ uploadDelayRadioGroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { |
|
59 |
+ @Override |
|
60 |
+ public void onCheckedChanged(RadioGroup group, @IdRes int checkedId) { |
|
61 |
+ if(checkedId==R.id.rb_upload_fast){ |
|
62 |
+ Preferences.getInstance().setUploadDelay(5); |
|
63 |
+ }else if(checkedId ==R.id.rb_upload_normal){ |
|
64 |
+ Preferences.getInstance().setUploadDelay(10); |
|
65 |
+ }else if(checkedId==R.id.rb_upload_slow){ |
|
66 |
+ Preferences.getInstance().setUploadDelay(15); |
|
67 |
+ } |
|
68 |
+ } |
|
69 |
+ }); |
|
47 | 70 |
ViewSwitcher.ViewFactory factory = new ViewSwitcher.ViewFactory() { |
48 | 71 |
|
49 | 72 |
public View makeView() { |
@@ -59,6 +82,7 @@ public class BriefsActivity extends BaseActivity implements BriefsContract.View{ |
||
59 | 82 |
presenter = new BriefsPresenter(this,this); |
60 | 83 |
} |
61 | 84 |
|
85 |
+ |
|
62 | 86 |
@OnClick(R.id.switcher_order_msg) |
63 | 87 |
public void clickOrderMsg(){ |
64 | 88 |
presenter.clickCurrentOrderMsg(); |
@@ -88,6 +88,14 @@ public class Preferences { |
||
88 | 88 |
return mPrefs.getString("patchUrl",NullStr); |
89 | 89 |
} |
90 | 90 |
|
91 |
+ public void setUploadDelay(int delay){ |
|
92 |
+ mPrefs.edit().putInt("delay",delay).commit(); |
|
93 |
+ } |
|
94 |
+ |
|
95 |
+ public int getUploadDelay(){ |
|
96 |
+ return mPrefs.getInt("delay",10); |
|
97 |
+ } |
|
98 |
+ |
|
91 | 99 |
public void clearPrefs(){ |
92 | 100 |
mPrefs.edit().clear().commit(); |
93 | 101 |
} |
@@ -20,6 +20,7 @@ import ai.pai.lensman.App; |
||
20 | 20 |
import ai.pai.lensman.R; |
21 | 21 |
import ai.pai.lensman.bean.PhotoBean; |
22 | 22 |
import ai.pai.lensman.db.DBService; |
23 |
+import ai.pai.lensman.db.Preferences; |
|
23 | 24 |
import ai.pai.lensman.service.UploadService; |
24 | 25 |
import ai.pai.lensman.utils.Constants; |
25 | 26 |
import ai.pai.lensman.utils.ImageLoaderUtils; |
@@ -33,12 +34,13 @@ public class PhotoRecyclerAdapter extends RecyclerView.Adapter<PhotoRecyclerAdap |
||
33 | 34 |
private LayoutInflater mInflater; |
34 | 35 |
private DisplayImageOptions options; |
35 | 36 |
private ArrayList<PhotoBean> photoList; |
36 |
- |
|
37 |
+ private int delay = 10; |
|
37 | 38 |
public PhotoRecyclerAdapter(Context context){ |
38 | 39 |
this.context = context; |
39 | 40 |
width = DeviceUtils.getScreenWidth(context); |
40 | 41 |
mInflater = LayoutInflater.from(context); |
41 | 42 |
options = ImageLoaderUtils.getOptions(R.drawable.default_img); |
43 |
+ delay = Preferences.getInstance().getUploadDelay(); |
|
42 | 44 |
} |
43 | 45 |
|
44 | 46 |
public PhotoBean getPhotoAt(int position){ |
@@ -103,7 +105,7 @@ public class PhotoRecyclerAdapter extends RecyclerView.Adapter<PhotoRecyclerAdap |
||
103 | 105 |
}else{ |
104 | 106 |
holder.errorLayout.setVisibility(View.GONE); |
105 | 107 |
} |
106 |
- long timeLeft = 30-(System.currentTimeMillis()-item.captureTime)/1000; |
|
108 |
+ long timeLeft = delay-(System.currentTimeMillis()-item.captureTime)/1000; |
|
107 | 109 |
|
108 | 110 |
if(timeLeft<0|| DBService.getInstance().isPhotoUploaded(item.photoId)){ |
109 | 111 |
item.canDelete = false; |
@@ -328,8 +328,8 @@ |
||
328 | 328 |
android:id="@+id/rb_upload_fast" |
329 | 329 |
android:layout_width="wrap_content" |
330 | 330 |
android:layout_height="wrap_content" |
331 |
- android:layout_marginLeft="10dp" |
|
332 |
- android:layout_marginRight="10dp" |
|
331 |
+ android:layout_marginLeft="15dp" |
|
332 |
+ android:layout_marginRight="15dp" |
|
333 | 333 |
android:textColor="@color/dark_grey" |
334 | 334 |
android:textSize="16sp" |
335 | 335 |
android:text="@string/upload_fast"/> |
@@ -339,8 +339,8 @@ |
||
339 | 339 |
android:checked="true" |
340 | 340 |
android:layout_width="wrap_content" |
341 | 341 |
android:layout_height="wrap_content" |
342 |
- android:layout_marginLeft="10dp" |
|
343 |
- android:layout_marginRight="10dp" |
|
342 |
+ android:layout_marginLeft="15dp" |
|
343 |
+ android:layout_marginRight="15dp" |
|
344 | 344 |
android:textColor="@color/dark_grey" |
345 | 345 |
android:textSize="16sp" |
346 | 346 |
android:text="@string/upload_normal"/> |
@@ -350,8 +350,8 @@ |
||
350 | 350 |
android:id="@+id/rb_upload_slow" |
351 | 351 |
android:layout_width="wrap_content" |
352 | 352 |
android:layout_height="wrap_content" |
353 |
- android:layout_marginLeft="10dp" |
|
354 |
- android:layout_marginRight="10dp" |
|
353 |
+ android:layout_marginLeft="15dp" |
|
354 |
+ android:layout_marginRight="15dp" |
|
355 | 355 |
android:textColor="@color/dark_grey" |
356 | 356 |
android:textSize="16sp" |
357 | 357 |
android:text="@string/upload_slow"/> |